package com.hongyun.tms.web.controller;

import com.hongyun.tms.common.dto.tug.SelecSearchDTO;
import com.hongyun.tms.domain.AjaxResult;
import com.hongyun.tms.service.SearchService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping(value = "/internal/public")
@Validated
@Slf4j
public class PublicController {
    //
    @Resource
    private SearchService searchService;


    /**
     * 获取本地下拉框数据源,通过单个类型
     *
     * @return
     */
    @GetMapping("/getLocalSelect")
    public List<Map<String, Object>> getLocalSelect(@RequestParam Map<String, Object> params) {
        List<Map<String, Object>> res = searchService.getLocalSelect(params);
        return res;
    }

    @PostMapping("/getRemoteSelect")
    public AjaxResult getSelectDataSource(@RequestBody SelecSearchDTO selectCommonSearch) {
        List<Map<String, Object>> res = searchService.getRemoteSelect(selectCommonSearch);
        return AjaxResult.success(res);
    }
}

